package cn.cyber.wxfire.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //这里也可以配置路径
        registry.addViewController("/").setViewName("signIn");
        registry.addViewController("/index.html").setViewName("signIn");
        registry.addViewController("/main.html").setViewName("dashboard");
        registry.addViewController("/list.html").setViewName("stu/list");
        registry.addViewController("/add.html").setViewName("stu/add");
        registry.addViewController("/update.html").setViewName("stu/update");
        registry.addViewController("/classData.html").setViewName("class");
    }

    //国际化组件
    @Bean
    public LocaleResolver localeResolver(){
        return new MyLocaleResolve();
    }

    //添加过滤器
    /**
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor())
                .addPathPatterns("/**")         //添加拦截请求
                .excludePathPatterns("/index.html","/","/user/login","/css/**","/js/**","/img/**"); //排除的请求
    }*/
}
